const path = require("path")
const CopywebpackPlugin = require("copy-webpack-plugin")
const dvgisDist = "./node_modules/@dvgis"

module.exports = {
  // lintOnSave: false,
  publicPath: "./",
  productionSourceMap: false,
  devServer: {
    port: 2345,
    // open: true,
    open: true,
    disableHostCheck: true,
    proxy: {
      "/proxy": {
        // target: "http://60.211.208.101:8208",
        target: "http://172.18.10.9:5099/",
        changeOrigin: true,
        pathRewrite: {
          "^/proxy": "/",
        },
      },
      "/geoserver": {
        target: "http://60.211.206.104:5099/",
        ws: false,
        changeOrigin: true,
        pathRewrite: {
          "^/geoserver": "/geoserver",
        },
      },
    },
  },
  /* configureWebpack: () => {
    return {
      externals: {
        vue: "Vue",
        "vue-router": "VueRouter",
        vuex: "Vuex",
        "element-ui": "ELEMENT",
      },
    }
  }, */
  // transpileDependencies: ["@cesium"],
  chainWebpack: config => {
    config.plugin("copy").use(CopywebpackPlugin, [
      [
        {
          from: path.join(dvgisDist, "dc-sdk/dist/resources"),
          to: "libs/dc-sdk/resources",
        },
      ],
    ])
  },
}
